package com.lagou.edu.controller;

import com.lagou.edu.entity.Student;
import com.lagou.edu.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/stu")
public class StudentController {

    @Autowired
    private StudentService studentService;

    @PostMapping
    public void addStudent(@RequestBody Student student){
        studentService.save(student);
    }

    @GetMapping
    public List<Student> addStudent(){
        return studentService.list(null);
    }
}
